﻿@model MatchDataModel

@{ ViewBag.Title = "Create new Match"; }

<section>
    <div class="k-block grid_12 clearfix" id="createMatch">

        <div class="k-header k-state-selected">@ViewBag.Title</div>  

        @using (Html.BeginForm(FormMethod.Post)) 
        {
            @Html.AntiForgeryToken()
            
            <section>
                <fieldset>
                    <legend>Create match</legend>

                    <div>
                        @Html.LabelFor(m => m.MatchDate)
                    </div>
                    <div>
                        @Html.Kendo().DateTimePickerFor(m => m.MatchDate).Min(_DateTime.LowDate).Max(_DateTime.HighDate).Value(DateTime.Today).HtmlAttributes(new { style = "width: 200px" })
                        
                        <div>
                            @Html.ValidationMessageFor(m => m.MatchDate, string.Empty, new { @class = "k-block k-error-colored"})
                        </div>
                    </div>

                    <div>
                        @Html.LabelFor(m => m.CompetitionGuid)
                    </div>
                    <div>
                        @(Html.Kendo().ComboBoxFor(m => m.CompetitionGuid)
                            .DataValueField("Code")
                            .DataTextField("Description") 
                            .MinLength(2)
                            .Filter(FilterType.Contains)
                            .Delay(150)
                            .Placeholder("[Select competition]")
                            .HighlightFirst(true)
                            .IgnoreCase(true)
                            .Suggest(true)
                            .Value(string.Empty)
                            .HtmlAttributes(new { style = "width: 300px" })
                            .DataSource(source => { source.Read(read => { read.Action("GetCompetitionsJSON", "Create"); }).ServerFiltering(true); })
                        )
                        
                        <div>
                            @Html.ValidationMessageFor(m => m.CompetitionGuid, string.Empty, new { @class = "k-block k-error-colored"})
                        </div>
                    </div>

                    <div>
                        @Html.LabelFor(m => m.VenueGuid)
                    </div>
                    <div>
                        @(Html.Kendo().ComboBoxFor(m => m.VenueGuid)
                            .DataValueField("Code")
                            .DataTextField("Description") 
                            .MinLength(2)
                            .Filter(FilterType.Contains)
                            .Delay(150)
                            .Placeholder("[Select venue]")
                            .HighlightFirst(true)
                            .IgnoreCase(true)
                            .Suggest(true)
                            .Value(string.Empty)
                            .HtmlAttributes(new { style = "width: 300px" })
                            .DataSource(source => { source.Read(read => { read.Action("GetVenuesJSON", "Create"); }).ServerFiltering(true); })
                        )
                        
                        <div>
                            @Html.ValidationMessageFor(m => m.VenueGuid, string.Empty, new { @class = "k-block k-error-colored"})
                        </div>

                        <div>
                            @Html.LabelFor(m => m.Attendance)
                        </div>
                        <div>
                            @(Html.Kendo().NumericTextBoxFor(m => m.Attendance)
                                .Decimals(0)
                                .Format("#")
                                .Value(null)
                                .Min(0)
                                .Placeholder("[Attendance]")
                                .HtmlAttributes(new { style = "width: 150px" })
                            )
                        </div>
                    </div>

                    <div class="grid_5 alpha">
                        <div>
                            @Html.LabelFor(m => m.Team1Guid)
                        </div>
                        <div>
                            @(Html.Kendo().ComboBoxFor(m => m.Team1Guid)
                                .DataValueField("Code")
                                .DataTextField("Description") 
                                .MinLength(2)
                                .Filter(FilterType.Contains)
                                .Delay(150)
                                .Placeholder("[Select team 1]")
                                .HighlightFirst(true)
                                .IgnoreCase(true)
                                .Suggest(true)
                                .Value(string.Empty)
                                .HtmlAttributes(new { style = "width: 300px" })
                                .DataSource(source => { source.Read(read => { read.Action("GetTeamsJSON", "Create"); }).ServerFiltering(true); })
                            )
                        
                            <div>
                                @Html.ValidationMessageFor(m => m.Team1Guid, string.Empty, new { @class = "k-block k-error-colored"})
                            </div>
                        </div>

                        <div>
                            @Html.LabelFor(m => m.Team1HT)
                        </div>
                        <div>
                            @(Html.Kendo().NumericTextBoxFor(m => m.Team1HT)
                                .Decimals(0)
                                .Format("#")
                                .Value(null)
                                .Min(0)
                                .Placeholder("[HT]")
                                .HtmlAttributes(new { style = "width: 125px" })
                            )
                        </div>

                        <div>
                            @Html.LabelFor(m => m.Team1FT)
                        </div>
                        <div>
                            @(Html.Kendo().NumericTextBoxFor(m => m.Team1FT)
                                .Decimals(0)
                                .Format("#")
                                .Value(null)
                                .Min(0)
                                .Placeholder("[FT]")
                                .HtmlAttributes(new { style = "width: 125px" })
                            )
                        </div>
                    </div>

                    <div class="grid_6 omega">
                        <div>
                            @Html.LabelFor(m => m.Team2Guid)
                        </div>
                        <div>
                            @(Html.Kendo().ComboBoxFor(m => m.Team2Guid)
                                .DataValueField("Code")
                                .DataTextField("Description") 
                                .MinLength(2)
                                .Filter(FilterType.Contains)
                                .Delay(150)
                                .Placeholder("[Select team 2]")
                                .HighlightFirst(true)
                                .IgnoreCase(true)
                                .Suggest(true)
                                .Value(string.Empty)
                                .HtmlAttributes(new { style = "width: 300px" })
                                .DataSource(source => { source.Read(read => { read.Action("GetTeamsJSON", "Create"); }).ServerFiltering(true); })
                            )
                        </div>

                        <div>
                            @Html.ValidationMessageFor(m => m.Team2Guid, string.Empty, new { @class = "k-block k-error-colored"})
                        </div>

                        <div>
                            @Html.LabelFor(m => m.Team2HT)
                        </div>
                        <div>
                            @(Html.Kendo().NumericTextBoxFor(m => m.Team2HT)
                                .Decimals(0)
                                .Format("#")
                                .Value(null)
                                .Min(0)
                                .Placeholder("[HT]")
                                .HtmlAttributes(new { style = "width: 125px" })
                            )
                        </div>

                        <div>
                            @Html.LabelFor(m => m.Team2FT)
                        </div>
                        <div>
                            @(Html.Kendo().NumericTextBoxFor(m => m.Team2FT)
                                .Decimals(0)
                                .Format("#")
                                .Value(null)
                                .Min(0)
                                .Placeholder("[FT]")
                                .HtmlAttributes(new { style = "width: 125px" })
                            )
                        </div>
                        
                    </div>

                    <div class="clear-fix"></div>

                    <div>
                        <br />
                        <button class="k-button" type="submit" id="submitButton">
                            <span class="k-icon k-i-tick"></span>
                            <span>Save</span>
                        </button>
                    </div>

                </fieldset>
            </section>
        }
    </div>
</section>
